import request from '@/utils/request'
// 登录
export function login(data) {
  return request({
    url: '/login',
    method: 'post',
    data
  })
}
// 获取当前用户角色
export function getInfo() {
  return request({
    url: '/sysUserRoles',
    method: 'get'
  })
}
// 注销登录
export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}
// 获取用户列表
export function getList(data) {
  return request({
    url: '/system/user/list',
    method: 'get',
    params: data
  })
}
// 获取单个用户
export function getUser(userId) {
  const data = { userId: userId }
  return request({
    url: '/system/user/one',
    method: 'post',
    data
  })
}
// 添加用户
export function addUser(data) {
  return request({
    url: '/system/user/add',
    method: 'post',
    data
  })
}
// 更新用户
export function updateUser(data) {
  return request({
    url: '/system/user/edit',
    method: 'post',
    data
  })
}
// 删除用户
export function deleteUser(id) {
  const data = { id: id }
  return request({
    url: '/system/user/delete',
    method: 'post',
    data
  })
}
